<form class="layui-form" action="{:url()}" method="post" id="editForm">
    <div class="layui-inline">
        <label class="layui-form-label">{$formData.ft_name}=={$formData.g_name}</label>
        </div>
    </div>
    <div class="layui-inline show">
        <label class="layui-form-label">委外子工厂</label>
        <div class="layui-input-inline xm-select-demo" id="demo2" style="width: auto;min-width: 250px;">
        </div>
    </div>
    {:FormExt::input('订单号', 'client_ordernum', '', '请输入组名名称', 'required', 'lay-verify="required"')}

    <div class="pop-bottom-bar">
        <input type="hidden" class="field-id" name="id">
        <input type="hidden" name="group_id">
        <button type="submit" class="layui-btn layui-btn-normal" >提交保存</button>
        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
    </div>
</form>

{include file="system@block/layui" /}
<script src="__PUBLIC_JS__/jquery.2.1.4.min.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js?v={:config('hisiphp.version')}"></script>
<script>
    var formData = {:json_encode($formData)};
    var factoryAll= JSON.parse('{:json_encode($factoryAll)}');
    layui.use(['form', 'func'], function() {
        var $ = layui.jquery, form = layui.form;
        layui.func.assign(formData);
    });

    var demo2 = xmSelect.render({
        el: '#demo2',
        name:'group_id',
        autoRow: true,
        filterable: true,
        //单选模式
        radio: true,
        tree: {
            //是否显示树状结构
            show: true,
            //是否展示三角图标
            showFolderIcon: true,
            //是否显示虚线
            showLine: true,
            //间距
            indent: 20,
            //默认展开节点的数组, 为 true 时, 展开所有节点
            expandedKeys: [],
            //是否严格遵守父子模式
            strict: false,
            //是否开启极简模式
            simple: false,
            //点击节点是否展开
            clickExpand: true,
            //点击节点是否选中
            clickCheck: true,
        },
        //是否严格遵守父子模式
        strict: false,
        toolbar: {
            show: true,
            list: ['ALL', 'REVERSE', 'CLEAR']
        },
        // height: 'auto',
        data(){
            return factoryAll
        },
        on: function(data){

            console.log(data);
            //arr:  当前多选已选中的数据
            var arr = data.arr;
            //change, 此次选择变化的数据,数组
            var change = data.change;
            //isAdd, 此次操作是新增还是删除
            var isAdd = data.isAdd;
            $('[name="group_id"]').val(arr[0].value);

            //可以return一个数组, 代表想选中的数据
            //return []
        }
    })

</script>